{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "894cd943-ea90-4d95-beab-4f4eaef9124a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "101:[80, 85, 82]\n",
      "102:[70, 75, 72]\n",
      "103:[90, 95, 92]\n"
     ]
    }
   ],
   "source": [
    "studs= [{'sid':'103','Chinese': 90,'Math':95,'English':92},{'sid':'101','Chinese': 80,'Math':85,'English':82},{'sid':'102','Chinese': 70,'Math':75,'English':72}]\n",
    "scores = {}\n",
    "for stud in studs:\n",
    "    sv = stud. items()\n",
    "    v = []\n",
    "    for it in sv:\n",
    "        if it[0] =='sid':\n",
    "            k = it[1]\n",
    "        else:\n",
    "            v.append(it[1])\n",
    "    scores[k]  = v\n",
    "so = list(scores.items() )\n",
    "so.sort(key = lambda x:x[0],reverse = False)\n",
    "for stuItem in so:\n",
    "    print('{}:{}'.format(stuItem [0], stuItem [1]))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c76d668f-493f-47bd-9ce5-c35c25004ec4",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
